#!/bin/bash
if [ -n "$1" ] ; then
  data_str=$1
else
  data_str=`date -d "-1 days" +%F`
fi

sqoop import \
--connect jdbc:mysql://node101:3306/jtp_app_shujuku \
--driver com.mysql.jdbc.Driver \
--username root \
--password 123456 \
--query 'SELECT * FROM jtp_app_shujuku.t_md_areas WHERE $CONDITIONS;' \
--target-dir 'hdfs://node101:8020/warehouse/app_basic/t_md_areas/${data_str}' \
--fields-terminated-by '\001' \
--delete-target-dir \
--num-mappers 1 \
--null-non-string '\\N' \
--null-string '\\N'